﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class DAL_KhachHang
    {
        Connect da = new Connect();
        public DataTable showkhachhang()
        {
            string sql = "select * from KhachHang";
            DataTable dt = new DataTable();
            dt = da.GetTable(sql);
            return dt;
        }
        public void insertkhachhang(string mkh, string tkh, string dc, string sdt)
        {
            string sql = "insert KhachHang values('" + mkh + "',N'" + tkh + "',N'" + dc + "',N'" + sdt + "')";
            da.Excutenonquery(sql);

        }
        public void Updatekhachhang(string mkh1, string mkh, string tkh, string dc, string sdt)
        {
            string sql = "UPDATE KhachHang SET MaKH='" + mkh + "',TenKH=N'" + tkh + "',DiaChi=N'" + dc + "',SoDienThoai='" + sdt + "'where MaKH='" + mkh1 + "'";
            da.Excutenonquery(sql);

        }
        public void Deletekhachhang(string mkh_d)
        {
            string sql = "DELETE KhachHang WHERE MaKH='" + mkh_d + "'";
            da.Excutenonquery(sql);

        }
    }
}
